package x_yeyue.obj;

import java.awt.*;

public class ExplodeObj extends GameObj{
    // 定义一个image类型的静态数组，存放一串爆炸图
    static Image[] explodePic = new Image[16];
    // 定义变量来记录爆炸的次数
    int explodeCount = 0;
    // 定义一个静态代码块来将爆炸图片放到数组中
    static{
        for(int i = 0; i < explodePic.length; i ++){
            explodePic[i] = Toolkit.getDefaultToolkit().getImage("imgs/explode/e" + (i + 1) + ".gif");
        }
    }

    public ExplodeObj(int x, int y) {
        super(x, y);
    }

    @Override
    public void paintSelf(Graphics g) {
        if(explodeCount < 16){
            super.img = explodePic[explodeCount];
            super.paintSelf(g);
            explodeCount ++;
        }
        super.paintSelf(g);
    }
}
